﻿using System;
using System.Windows.Documents;

using agsXMPP.protocol.client;

namespace VSTalk.Engine.ViewModel.Messenger.MessageBuilder
{
    public class TextMessageBuilder : IMessageBuilder
    {
        public Message Create(FlowDocument document)
        {
            var body = new TextRange(document.ContentStart, document.ContentEnd)
                    .Text
                    .TrimEnd(Environment.NewLine.ToCharArray());
            var msg = new Message();
            msg.Body = body;
            return msg;
        }
    }
}